package com.wtf.test;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.PrintWriter;
import java.util.List;

import android.app.Activity;
import android.content.Context;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import android.os.Bundle;
import android.os.Environment;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class WTFTestActivity extends Activity{
    /** Called when the activity is first created. */

	
    SensorManager mSensorManager;
    Sensor mAccelerometer;
    
    Button reading;
    
    
    
    MySensorListener myListener;
	
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        

        
        reading = (Button) findViewById(R.id.button1);
        reading.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                mSensorManager = (SensorManager)getSystemService(Context.SENSOR_SERVICE);
        		List<Sensor> sensorList = mSensorManager.getSensorList(Sensor.TYPE_ACCELEROMETER);
        		mAccelerometer = sensorList.get(0);
        		
        		myListener = new MySensorListener();
        		
        		mSensorManager.registerListener(myListener, mAccelerometer, SensorManager.SENSOR_DELAY_FASTEST);
                // Perform action on click
            	reading.setText("nonono");
            }
        });
		

    }
    
   

    


////
////    protected void onResume() {
////        super.onResume();
////        mSensorManager.registerListener(this, mAccelerometer, SensorManager.SENSOR_DELAY_NORMAL);
////    }
//
////    protected void onPause() {
////        super.onPause();
////        mSensorManager.unregisterListener(this);
////    }
//

}